Skip to content

Add send benchmark #238

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add send benchmark #238

wants to merge 5 commits into from

Conversation

pmenzel
Copy link
Contributor

@pmenzel pmenzel commented Mar 18, 2022

Add @donald’s benchmark to measure the bandwidth between two systems.

Receiver:

@okeanos$ netcat -l -p 34141 &> /dev/null

Sender:

@ira$ ./send okeanos 34141
start : 1647626264.104183
close : 1647626274.104254
done  : 1647626274.108967
10055753200 bytes in 10.004784 seconds
1005094482.799429 bytes / seconds
8040755862.395430 bits  / seconds
8040755.862395 kBit/s  / seconds
8040.755862 MBit/s  / seconds

donald and others added 5 commits March 18, 2022 15:18
Copy from `~buczek/src/small/send.c`.
Fix the warnings below:

    $ make send
    cc     send.c   -o send
    send.c:41:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
     main(int argc,char *argv[]) {
     ^~~~
    send.c: In function ‘main’:
    send.c:63:5: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
         memset(buffer,0xA3,sizeof(buffer));
         ^~~~~~
    send.c:63:5: warning: incompatible implicit declaration of built-in function ‘memset’
    send.c:63:5: note: include ‘<string.h>’ or provide a declaration of ‘memset’
    send.c:79:5: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
         memcpy(&sin.sin_addr,he->h_addr,he->h_length);
         ^~~~~~
    send.c:79:5: warning: incompatible implicit declaration of built-in function ‘memcpy’
    send.c:79:5: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’

Reported-by: gcc (GCC) 7.5.0
Build with `make send`, add it to the git archive, and install it to
`/usr/bin`.
Currently, negative benchmark values are shown:

    @ira$ send okeanos 34141
    start : 1647613816.868339
    close : 1647613826.868524
    done  : 1647613826.874427
    -1209148824 bytes in 10.006088 seconds
    -120841314.207910 bytes / seconds
    -966730513.663282 bits  / seconds
    -966730.513663 kBit/s  / seconds
    -966.730514 MBit/s  / seconds

With 10 Gbit/s, in 10 s seconds theoretically up to 12.5 GB could be
transferred. But a 32-bit (signed) integer can at maximum store the
number (2147483648 - 1), and the unsigned integer around 4.3 million,
still too small.

Therefore, use unsigned long to be able to store the number bytes
without overflow for the foreseeable future. Now we have:

    @ira$ ./send okeanos 34141
    start : 1647626064.313421
    close : 1647626074.313503
    done  : 1647626074.317791
    10534190976 bytes in 10.004370 seconds
    1052958954.536867 bytes / seconds
    8423671636.294939 bits  / seconds
    8423671.636295 kBit/s  / seconds
    8423.671636 MBit/s  / seconds

Resolves: mariux64/mariux64-issues#23
@donald
Copy link
Collaborator

donald commented Mar 18, 2022

I know suggested to import this to mxtools but I didn't realize, that this needs to be compiled. We had this before and reverted it it (#135). For that it was suggested to check in the binary as well, as you did here, but I didn't like the idea. Do you? Is the last commit ("Make byteCount unisgned long") in the binary?

@pmenzel
Copy link
Contributor Author

pmenzel commented Mar 18, 2022

For that it was suggested to check in the binary as well, as you did here, but I didn't like the idea. Do you?

I wouldn’t say I like it. It’s not very elegant, but solves our problem and improves the current situation. I have no problem making it a separate repository, but having to create a new release and doing the bee dance each time, is maybe also quite time consuming compared to the fact, that it’s as small tool infrequently used. But discussing it, takes probably more time than choosing any of the two options.

Is the last commit ("Make byteCount unisgned long") in the binary?

Yes, I rebuilt the binary with that change, and committed it.

@donald
Copy link
Collaborator

donald commented Mar 21, 2022

Okay, than lets try it this way. Is "send" as a public command to generic?

@wwwutz
Copy link
Contributor

wwwutz commented Mar 21, 2022

Okay, than lets try it this way. Is "send" as a public command to generic?

nope. i like it 8-)

@donald
Copy link
Collaborator

donald commented Mar 21, 2022

okay with me.

@donald donald force-pushed the master branch 2 times, most recently from 91ee9fc to 647c337 Compare November 29, 2023 09:21
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants